package elven.codingit.easyutil.dto;

import java.io.Serializable;

/**
 * 通用返回错误dto
 * @author elven 2016年5月24日
 */
public class ReturnDto implements Serializable{

	public String code;
	public String message;
	public boolean status = true;
	public Object content;
	
	public ReturnDto(){}
	
	public static class Builder {
		
		private boolean buildStatus = true;
		private String buildCode = null;
		private String buildMessage = null;
		private Object buildContent = null;
		public Builder(boolean status){
			this.buildStatus = status;
		}
		
		public Builder code(String code){
			this.buildCode = code;
			return this;
		}
		
		public Builder message(String messge){
			this.buildMessage =messge;
			return this;
		}
		
		public Builder content(Object content){
			this.buildContent = content;
			return this;
		}
		
		public ReturnDto build() { // 构建，返回一个新对象
            return new ReturnDto(this);
        }
	}
	
	private ReturnDto(Builder builder) {
		this.status = builder.buildStatus;
		this.code = builder.buildCode;
		this.message = builder.buildMessage;
		this.content = builder.buildContent;
	}
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public boolean isStatus() {
		return status;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}

	public Object getContent() {
		return content;
	}

	public void setContent(Object content) {
		this.content = content;
	}
}
